home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / quantum.c < prev    next >
C/C++ Source or Header  |  2000-05-13  |  8KB  |  255 lines

  1. /*
  2.   quantum
  3.  
  4.   Paul Forgey, 1997
  5.  
  6.   This code is donated to the MAME team, and inherits all copyrights
  7.   and restrictions from MAME
  8. */
  9.  
  10.  
  11. /*
  12.     QUANTUM MEMORY MAP (per schem):
  13.  
  14.     000000-003FFF    ROM0
  15.     004000-004FFF    ROM1
  16.     008000-00BFFF    ROM2
  17.     00C000-00FFFF    ROM3
  18.     010000-013FFF    ROM4
  19.  
  20.     018000-01BFFF    RAM0
  21.     01C000-01CFFF    RAM1
  22.  
  23.     940000            TRACKBALL
  24.     948000            SWITCHES
  25.     950000            COLORRAM
  26.     958000            CONTROL (LED and coin control)
  27.     960000-970000    RECALL (nvram read)
  28.     968000            VGRST (vector reset)
  29.     970000            VGGO (vector go)
  30.     978000            WDCLR (watchdog)
  31.     900000            NVRAM (nvram write)
  32.     840000            I/OS (sound and dip switches)
  33.     800000-801FFF    VMEM (vector display list)
  34.     940000            I/O (shematic label really - covered above)
  35.     900000            DTACK1
  36.  
  37. */
  38.  
  39.  
  40. #include "driver.h"
  41. #include "vidhrdw/vector.h"
  42. #include "vidhrdw/avgdvg.h"
  43.  
  44.  
  45.  
  46. int quantum_interrupt(void);
  47. READ_HANDLER( quantum_switches_r );
  48. WRITE_HANDLER( quantum_led_w );
  49. WRITE_HANDLER( quantum_snd_w );
  50. READ_HANDLER( quantum_snd_r );
  51. READ_HANDLER( quantum_trackball_r );
  52. READ_HANDLER( quantum_input_1_r );
  53. READ_HANDLER( quantum_input_2_r );
  54.  
  55. READ_HANDLER( foodf_nvram_r );
  56. WRITE_HANDLER( foodf_nvram_w );
  57. void foodf_nvram_handler(void *file,int read_or_write);
  58.  
  59.  
  60.  
  61. struct MemoryReadAddress quantum_read[] =
  62. {
  63.     { 0x000000, 0x013fff, MRA_ROM },
  64.     { 0x018000, 0x01cfff, MRA_BANK1 },
  65.     { 0x800000, 0x801fff, MRA_BANK2 },
  66.     { 0x840000, 0x84003f, quantum_snd_r },
  67.     { 0x900000, 0x9001ff, foodf_nvram_r },
  68.     { 0x940000, 0x940001, quantum_trackball_r }, /* trackball */
  69.     { 0x948000, 0x948001, quantum_switches_r },
  70.     { 0x978000, 0x978001, MRA_NOP },    /* ??? */
  71.     { -1 }    /* end of table */
  72. };
  73.  
  74. struct MemoryWriteAddress quantum_write[] =
  75. {
  76.     { 0x000000, 0x013fff, MWA_ROM },
  77.     { 0x018000, 0x01cfff, MWA_BANK1 },
  78.     { 0x800000, 0x801fff, MWA_BANK2, &vectorram, &vectorram_size },
  79.     { 0x840000, 0x84003f, quantum_snd_w },
  80.     { 0x900000, 0x9001ff, foodf_nvram_w },
  81.     { 0x950000, 0x95001f, quantum_colorram_w },
  82.     { 0x958000, 0x958001, quantum_led_w },
  83.     { 0x960000, 0x960001, MWA_NOP },    /* enable NVRAM? */
  84.     { 0x968000, 0x968001, avgdvg_reset_w },
  85. //    { 0x970000, 0x970001, avgdvg_go_w },
  86. //    { 0x978000, 0x978001, watchdog_reset_w },
  87.     /* the following is wrong, but it's the only way I found to fix the service mode */
  88.     { 0x978000, 0x978001, avgdvg_go_w },
  89.     { -1 }    /* end of table */
  90. };
  91.  
  92.  
  93.  
  94. INPUT_PORTS_START( quantum )
  95.     PORT_START    /* IN0 */
  96.     /* YHALT here MUST BE ALWAYS 0  */
  97.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_UNKNOWN )    /* vg YHALT */
  98.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 )
  99.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  100.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  101.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
  102.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  103.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  104.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  105.  
  106. /* first POKEY is SW2, second is SW1 -- more confusion! */
  107.     PORT_START /* DSW0 */
  108.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) )
  109.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  110.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  111.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
  112.     PORT_DIPSETTING(    0x40, DEF_STR( Free_Play ) )
  113.     PORT_DIPNAME( 0x30, 0x00, "Right Coin" )
  114.     PORT_DIPSETTING(    0x00, "*1" )
  115.     PORT_DIPSETTING(    0x20, "*4" )
  116.     PORT_DIPSETTING(    0x10, "*5" )
  117.     PORT_DIPSETTING(    0x30, "*6" )
  118.     PORT_DIPNAME( 0x08, 0x00, "Left Coin" )
  119.     PORT_DIPSETTING(    0x00, "*1" )
  120.     PORT_DIPSETTING(    0x08, "*2" )
  121.     PORT_DIPNAME( 0x07, 0x00, "Bonus Coins" )
  122.     PORT_DIPSETTING(    0x00, "None" )
  123.     PORT_DIPSETTING(    0x01, "1 each 5" )
  124.     PORT_DIPSETTING(    0x02, "1 each 4" )
  125.     PORT_DIPSETTING(    0x05, "1 each 3" )
  126.     PORT_DIPSETTING(    0x06, "2 each 4" )
  127.  
  128.     PORT_START /* DSW1 */
  129.     PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  130.  
  131.     PORT_START      /* IN2 */
  132.     PORT_ANALOG( 0x0f, 0, IPT_TRACKBALL_Y | IPF_REVERSE, 10, 10, 0,0)
  133.  
  134.     PORT_START      /* IN3 */
  135.     PORT_ANALOG( 0x0f, 0, IPT_TRACKBALL_X, 10, 10, 0, 0 )
  136. INPUT_PORTS_END
  137.  
  138.  
  139.  
  140. static struct POKEYinterface pokey_interface =
  141. {
  142.     2,    /* 2 chips */
  143.     600000,        /* .6 MHz? (hand tuned) */
  144.     { 50, 50 },
  145.     /* The 8 pot handlers */
  146.     { quantum_input_1_r, quantum_input_2_r },
  147.     { quantum_input_1_r, quantum_input_2_r },
  148.     { quantum_input_1_r, quantum_input_2_r },
  149.     { quantum_input_1_r, quantum_input_2_r },
  150.     { quantum_input_1_r, quantum_input_2_r },
  151.     { quantum_input_1_r, quantum_input_2_r },
  152.     { quantum_input_1_r, quantum_input_2_r },
  153.     { quantum_input_1_r, quantum_input_2_r },
  154.     /* The allpot handler */
  155.     { 0, 0 },
  156. };
  157.  
  158.  
  159.  
  160. static struct MachineDriver machine_driver_quantum =
  161. {
  162.     /* basic machine hardware */
  163.     {
  164.         {
  165.             CPU_M68000,
  166.             6000000,        /* 6MHz */
  167.             quantum_read,quantum_write,0,0,
  168.             quantum_interrupt,3    /* IRQ rate = 750kHz/4096 */
  169.         }
  170.     },
  171.     60, 0,    /* frames per second, vblank duration (vector game, so no vblank) */
  172.     1,
  173.     0,
  174.  
  175.     /* video hardware */
  176.     300, 400, { 0, 600, 0, 900 },
  177.     0,
  178.     256, 0,
  179.     avg_init_palette_multi,
  180.  
  181.     VIDEO_TYPE_VECTOR,
  182.     0,
  183.     avg_start_quantum,
  184.     avg_stop,
  185.     vector_vh_screenrefresh,
  186.  
  187.     /* sound hardware */
  188.     0,0,0,0,
  189.     {
  190.         {
  191.             SOUND_POKEY,
  192.             &pokey_interface
  193.         }
  194.     },
  195.  
  196.     foodf_nvram_handler
  197. };
  198.  
  199.  
  200.  
  201. /***************************************************************************
  202.  
  203.   Game driver(s)
  204.  
  205. ***************************************************************************/
  206.  
  207. ROM_START( quantum )
  208.     ROM_REGION( 0x014000, REGION_CPU1 )
  209.     ROM_LOAD_EVEN( "136016.201",   0x000000, 0x002000, 0x7e7be63a )
  210.     ROM_LOAD_ODD ( "136016.206",   0x000000, 0x002000, 0x2d8f5759 )
  211.     ROM_LOAD_EVEN( "136016.102",   0x004000, 0x002000, 0x408d34f4 )
  212.     ROM_LOAD_ODD ( "136016.107",   0x004000, 0x002000, 0x63154484 )
  213.     ROM_LOAD_EVEN( "136016.203",   0x008000, 0x002000, 0xbdc52fad )
  214.     ROM_LOAD_ODD ( "136016.208",   0x008000, 0x002000, 0xdab4066b )
  215.     ROM_LOAD_EVEN( "136016.104",   0x00C000, 0x002000, 0xbf271e5c )
  216.     ROM_LOAD_ODD ( "136016.109",   0x00C000, 0x002000, 0xd2894424 )
  217.     ROM_LOAD_EVEN( "136016.105",   0x010000, 0x002000, 0x13ec512c )
  218.     ROM_LOAD_ODD ( "136016.110",   0x010000, 0x002000, 0xacb50363 )
  219. ROM_END
  220.  
  221. ROM_START( quantum1 )
  222.     ROM_REGION( 0x014000, REGION_CPU1 )
  223.     ROM_LOAD_EVEN( "136016.101",   0x000000, 0x002000, 0x5af0bd5b )
  224.     ROM_LOAD_ODD ( "136016.106",   0x000000, 0x002000, 0xf9724666 )
  225.     ROM_LOAD_EVEN( "136016.102",   0x004000, 0x002000, 0x408d34f4 )
  226.     ROM_LOAD_ODD ( "136016.107",   0x004000, 0x002000, 0x63154484 )
  227.     ROM_LOAD_EVEN( "136016.103",   0x008000, 0x002000, 0x948f228b )
  228.     ROM_LOAD_ODD ( "136016.108",   0x008000, 0x002000, 0xe4c48e4e )
  229.     ROM_LOAD_EVEN( "136016.104",   0x00C000, 0x002000, 0xbf271e5c )
  230.     ROM_LOAD_ODD ( "136016.109",   0x00C000, 0x002000, 0xd2894424 )
  231.     ROM_LOAD_EVEN( "136016.105",   0x010000, 0x002000, 0x13ec512c )
  232.     ROM_LOAD_ODD ( "136016.110",   0x010000, 0x002000, 0xacb50363 )
  233. ROM_END
  234.  
  235. ROM_START( quantump )
  236.     ROM_REGION( 0x014000, REGION_CPU1 )
  237.     ROM_LOAD_EVEN( "quantump.2e",  0x000000, 0x002000, 0x176d73d3 )
  238.     ROM_LOAD_ODD ( "quantump.3e",  0x000000, 0x002000, 0x12fc631f )
  239.     ROM_LOAD_EVEN( "quantump.2f",  0x004000, 0x002000, 0xb64fab48 )
  240.     ROM_LOAD_ODD ( "quantump.3f",  0x004000, 0x002000, 0xa52a9433 )
  241.     ROM_LOAD_EVEN( "quantump.2h",  0x008000, 0x002000, 0x5b29cba3 )
  242.     ROM_LOAD_ODD ( "quantump.3h",  0x008000, 0x002000, 0xc64fc03a )
  243.     ROM_LOAD_EVEN( "quantump.2k",  0x00C000, 0x002000, 0x854f9c09 )
  244.     ROM_LOAD_ODD ( "quantump.3k",  0x00C000, 0x002000, 0x1aac576c )
  245.     ROM_LOAD_EVEN( "quantump.2l",  0x010000, 0x002000, 0x1285b5e7 )
  246.     ROM_LOAD_ODD ( "quantump.3l",  0x010000, 0x002000, 0xe19de844 )
  247. ROM_END
  248.  
  249.  
  250.  
  251. GAMEX( 1982, quantum,  0,       quantum, quantum, 0, ROT0, "Atari", "Quantum (rev 2)", GAME_WRONG_COLORS )
  252. GAMEX( 1982, quantum1, quantum, quantum, quantum, 0, ROT0, "Atari", "Quantum (rev 1)", GAME_WRONG_COLORS )
  253. GAMEX( 1982, quantump, quantum, quantum, quantum, 0, ROT0, "Atari", "Quantum (prototype)", GAME_WRONG_COLORS )
  254.  
  255.